package com.bussiness.system.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import java.util.Map;

/**
 *
 * @author xlr
 * @email liru@tengyue360
 * @date 2018-08-11 13:06:22
 */
public class TransferUtil {


    public static <T> T transfer(Object text, Class<T> clazz) {
        return JSONObject.parseObject( JSONObject.toJSONString(text), clazz);
    }

    /**
     * 实体类转换 Map
     * @param text
     * @return
     */
    public static Map<String,Object> beanToMap(Object text){
        String json = JSON.toJSONString(text);
        Map<String,Object> map = JSON.parseObject(json);
        return map;
    }
}
